/**
 * Created by Administrator on 2015/6/2.
 */
$(function(){
    $("[data-toggle='tooltip']").tooltip();

    var jw=$(window);
    //滚动效果思路 --
    //1.确定出需要滚动的div在什么时候跟随窗口滚动
    //2.计算出滚动的范围
    //3.在滚动的范围改变div的位置样式
    jw.scroll(function(){
        var scrollHeight = jw.scrollTop();
        if(scrollHeight > 100){
            $(".page-nav").css({
                top:scrollHeight +"px"
            });
        }else if(scrollHeight <= 100){
            $(".page-nav").css({
                top:"100px"
            });
        }
    });

    $("#nav-btn").click(function(){
        $(this).find("span").toggleClass("glyphicon-triangle-right");
        $(this).find("span").toggleClass("glyphicon-triangle-bottom");
    });

    $(".quotes-nav li>div").hover(function(){
        $(".quotes-list-show").hide();
        $(".quotes-nav li>div").each(function(){
            this.className = "quotes-nav-div";
        });
        this.className="select";
        $(this).children().eq(1).show();
    },function(){
        $(".quotes-list-show").hide();
        this.className = "quotes-nav-div";
    });

    var timer=null;
    $(".article-list-1").hover(function(){
        var obj = null;
        obj = $(this);
        timer=setTimeout(function() {
            obj.find(".imgplay").animate({'opacity': 1}, 300);
            obj.find(".info-box").animate({'height': '155px'}, 300);
            obj.find(".read-number").show();
            obj.find('p').animate({"height": "52px", "opacity": 1}, 300).show();
        },200);
    },function(){
        clearTimeout(timer);
        var obj = null;
        obj = $(this);
        obj.find(".imgplay").animate({'opacity':0},300);
        obj.find(".info-box").animate({'height':'88'},300);
        obj.find(".read-number").hide();
        obj.find('p').animate({"height":"0px","opacity":0},300);
        setTimeout(function(){
            obj.find('p').hide();
        },300);

    });

    $(".button").click(function(){
        $(".button").each(function(){
            this.style.color="";
            this.style.border="";
        });
        this.style.color="#41BD3D";
        this.style.border="1px solid rgba(65,189,61,1)";
    });

    $(".banner").hover(function(){
        $(".carousel-control").css({"opacity":"1"});
    },function(){
        $(".carousel-control").css({"opacity":"0"});
    });
});